<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>正方形加 四个小边角</title>
</head>

<body>
  <div class="wrap">
    <div class="box">正方形加 四个小边角<div class="box-footer"></div>
    </div>
  </div>
</body>

<style>
  * {
    margin: 0;
    padding: 0;
  }

  .wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
  }

  .box {
    position: relative;
    width: 300px;
    height: 300px;
    line-height: 300px;
    text-align: center;
    background-color: aqua;
  }

  /* 
  *  用到了 伪元素
  *  ::before
  *  ::after
  */

  /* 上边两个边角 */
  .box::before {
    position: absolute;
    top: 0;
    left: 0;
    width: 20px;
    height: 20px;
    border-top: 3px solid blueviolet;
    border-left: 3px solid blueviolet;
    content: '';
  }

  .box::after {
    position: absolute;
    top: 0;
    right: 0;
    width: 20px;
    height: 20px;
    border-top: 3px solid blueviolet;
    border-right: 3px solid blueviolet;
    content: '';
  }

  /* 下边两个边角 */
  .box-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;

  }

  .box-footer::before {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 20px;
    height: 20px;
    border-bottom: 3px solid blueviolet;
    border-left: 3px solid blueviolet;
    content: '';
  }

  .box-footer::after {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    border-bottom: 3px solid blueviolet;
    border-right: 3px solid blueviolet;
    content: '';
  }
</style>

</html>